//
//  HYSameTableViewCell.m
//  MusicMV
//
//  Created by Eternity on 16/3/20.
//  Copyright © 2016年 Eternity. All rights reserved.
//

#import "HYSameTableViewCell.h"

@interface HYSameTableViewCell ()

@property (nonatomic , strong) UIImageView *MVimage;
@property (nonatomic , strong) UILabel *titleLabel;
@property (nonatomic , strong) UILabel *artistNameLabel;
@property (nonatomic , strong) UILabel *totalViewsLabel;


@end


@implementation HYSameTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;
}

- (void)create {
    
    self.MVimage = [[UIImageView alloc] init];
    [self.contentView addSubview:_MVimage];
    self.artistNameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_artistNameLabel];
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_titleLabel];
    self.totalViewsLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_totalViewsLabel];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _MVimage.frame = CGRectMake(0, 0, SCREEN_WIDTH / 2.5, self.contentView.frame.size.height);
    _titleLabel.frame = CGRectMake(SCREEN_WIDTH / 2.5 + 10 * wt, 15 * wt, SCREEN_WIDTH / 2, 20 * ht);
    _titleLabel.textColor = [UIColor whiteColor];
    _titleLabel.backgroundColor = [UIColor clearColor];
    _titleLabel.font = [UIFont systemFontOfSize:16];
    _artistNameLabel.frame = CGRectMake(SCREEN_WIDTH / 2.5 + 10 * wt, 40 * ht, SCREEN_WIDTH / 2, 20 * ht);
    _artistNameLabel.textColor = RGBA(0, 210, 160, 1);
    
    _artistNameLabel.backgroundColor = [UIColor clearColor];
    _artistNameLabel.font = [UIFont systemFontOfSize:16];
    _totalViewsLabel.frame = CGRectMake(SCREEN_WIDTH / 2.5 + 10 * wt, 65 * ht, SCREEN_WIDTH / 2, 20 * ht);
    _totalViewsLabel.textColor = [UIColor lightGrayColor];
    _totalViewsLabel.backgroundColor = [UIColor clearColor];
    _totalViewsLabel.font = [UIFont systemFontOfSize:13];
}


- (void)setModel:(HYVideoPlayerModel *)model {

    _model = model;
    [_MVimage sd_setImageWithURL:[NSURL URLWithString:_model.thumbnailPic]];
    _titleLabel.text = _model.title;
    _artistNameLabel.text = _model.artistName;
    _totalViewsLabel.text =[NSString stringWithFormat:@"播放次数:%@",_model.totalViews];

}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
